<?php if ( !defined('BASEPATH')) exit('No direct script access allowed');

class Consumption_summary extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->load->model('wus');
		$this->load->model($this->session->userdata('formodel'));
		$this->load->library('variable');

	}


	public function index(){
	  $this->load->view('layouts/header',$this->variable->load_data($this->session->userdata('title')));
	  $this->load->view($this->session->userdata('formain'),array(
	  		'ranges'	=> 	$this->consumption_summary_model->getRanges(),
	  		'counts'	=>	$this->consumption_summary_model->get_locations(),
	  		'zones'		=>	$this->consumption_summary_model->getzoning()
	  	));
	  $this->load->view('layouts/footer');
	 }

	 public function cons_sum(){
	 		$query = $this->consumption_summary_model->get_summary($this->input->post('year'),$this->input->post('month'));
	 		echo json_encode($query);
	 }

	 public function get_pend(){

		$sure2 = $this->consumption_summary_model->get_names($_GET['zone'],$_GET['from'],$_GET['to']);

		$this->load->view($this->session->userdata('foradd'),array(

			'title' => 'Consumed List in '.$_GET['zone'].' ( '.$_GET['from'] .' - '.$_GET['to'].' ) ',

			'names'	=> $sure2

			));
	}



	

}
